/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.aaron.platform.view;

import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;

/**
 *
 * @author mac
 */
public class TestListBean extends DataListBean {

    private static Logger logger = Logger.getLogger(TestListBean.class);

    public TestListBean()
    {
        super();
        this.tableTitle = FacesUtil.getString("table_title_tasklist");
        logger.info("query data finished!");
    }

    @Override
    public void queryData() {
        List<DataObject> list = new ArrayList<DataObject>();
        list.add(new DataObject("aaron", Integer.valueOf(29)));
        list.add(new DataObject("vanilla", Integer.valueOf(26)));
        data.setWrappedData(list);
    }

    @Override
    public void initColumnHeaders() {
        headerColumns.add(new ColumnType(ColumnType.COLUMN_TEXT, "name", "Name", false, "60%"));
        headerColumns.add(new ColumnType(ColumnType.COLUMN_TEXT, "age", "Age", false, "40%"));
    }

    @Override
    public String getColumnValue() {
        String columnName = getColumnName();
        DataObject obj = (DataObject) data.getRowData();
        if (columnName.equals("name"))
        {
            return obj.getName();
        }
        else
        {
            return obj.getAge().toString();
        }
    }

}
